home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / Caml Light 0.7 / Caml Light 0.7 source / src / Makefile < prev    next >
Makefile  |  1995-07-04  |  4KB  |  129 lines

  1. MAKE = do make
  2. MAKEQ = do -quiet make
  3. SUBDIRS = runtime launch lib compiler linker librar toplevel lex yacc tools ∂
  4.           man appli
  5.  
  6. # Build the system for the first time
  7. world ƒ
  8.     execute :config
  9.     set CPPC "{CTOOLPPC}"
  10.     Directory tools; {MAKE} clprepro; Directory ::
  11.     duplicate -y :tools:clprepro :
  12.     Directory runtime;
  13.       {MAKEQ} all -d arch=68k;
  14.       {MAKEQ} all -d arch=PPC;
  15.     Directory ::
  16.     :tools:fatmerge :runtime:camlrunPPC :runtime:camlrun68k :camlrun
  17.     flush
  18.     Directory yacc;
  19.       {MAKEQ} all -d arch=68k;
  20.       {MAKEQ} all -d arch=PPC;
  21.     Directory ::
  22.     :tools:fatmerge :yacc:camlyaccPPC :yacc:camlyacc68k :camlyacc
  23.     flush
  24.     Directory lib; {MAKE} all; Directory ::
  25.     Directory compiler; {MAKE} all; Directory ::
  26.     Directory linker; {MAKE} all; Directory ::
  27.     Directory librar; {MAKE} all; Directory ::
  28.     Directory lex; {MAKE} all; Directory ::
  29.     Directory toplevel; {MAKE} all; Directory ::
  30.     Directory launch; {MAKE} all; Directory ::
  31.     set CPPC "{CAPPLPPC}"
  32.     Directory appli;
  33.       {MAKEQ} all -d arch=68k;
  34.       {MAKEQ} all -d arch=PPC;
  35.     Directory ::
  36.     :tools:fatmerge ':appli:caml light PPC' ':appli:caml light 68k' ':Caml Light'
  37.     echo "Let us quickly test the toplevel tool."
  38.     (echo '1+2;;'; ∂
  39.      echo 'let rec fib n = if n<2 then 1 else fib(n-1)+fib(n-2);;'; ∂
  40.      echo 'fib 20;;') | :camlrun :toplevel:camltop -stdlib :lib:
  41.     echo "Is that 10946 on the line above? Good."
  42.     echo "The CAML Light system is up and running."
  43.  
  44. # Rebuild the system (bootstrap)
  45. bootstrap ƒ backup promote again compare
  46.  
  47. # Save a copy of the current compiler
  48. backup ƒ
  49.     :tools:clbackup camlrun camlcomp camllink camllibr camllex 
  50.  
  51. # Make the newly compiled compiler the current compiler
  52. promote ƒ
  53.     flush
  54.     Duplicate -y :compiler:camlcomp :linker:camllink :librar:camllibr ∂
  55.                  :lex:camllex :
  56.  
  57. # Recompile bootstrapped Caml code from scratch
  58. again ƒ
  59.     flush
  60.     execute config
  61.     Directory lib; {MAKE} clean; {MAKE} all; Directory ::
  62.     Directory compiler; {MAKE} clean; {MAKE} all; Directory ::
  63.     Directory linker; {MAKE} clean; {MAKE} all; Directory ::
  64.     Directory librar; {MAKE} clean; {MAKE} all; Directory ::
  65.     Directory lex; {MAKE} clean; {MAKE} all; Directory ::
  66.  
  67. # Compare the current compiler with the newly compiled one
  68. compare ƒ
  69.     Set Exit 0
  70.     Equal -d camlcomp :compiler:camlcomp
  71.     Equal -d camllink :linker:camllink
  72.     Equal -d camllibr :librar:camllibr
  73.     Equal -d camllex :lex:camllex
  74.     Set Exit 1
  75.  
  76. # Restore the latest backup copy of the compiler
  77. restore ƒ
  78.     flush
  79.     :tools:clrestore camlrun camlcomp camllink camllibr camllex 
  80.  
  81. # Compile all Caml code
  82. compile ƒ
  83.     execute config
  84.     Directory lib; {MAKE} all; Directory ::
  85.     Directory compiler; {MAKE} all; Directory ::
  86.     Directory linker; {MAKE} all; Directory ::
  87.     Directory librar; {MAKE} all; Directory ::
  88.     Directory lex; {MAKE} all; Directory ::
  89.     Directory toplevel; {MAKE} all; Directory ::
  90.  
  91. # Install the Caml Light system
  92. install ƒ
  93.     execute config
  94.     NewFolder "{LIBDIR}" ||echo
  95.     newfolder "{BINDIR}" ||echo
  96.     duplicate -y camlmsgs.txt "{LIBDIR}"
  97.     for i in {SUBDIRS}
  98.       directory "{i}"; {MAKE} install; directory ::
  99.     end
  100.  
  101. # Remove the Caml Light system after installation
  102. uninstall ƒ
  103.     execute config
  104.     delete -y -i "{LIBDIR}"
  105.     delete -i "{BINDIR}"camlrun "{BINDIR}"camlc "{BINDIR}"camllight ∂
  106.               "{BINDIR}"camlyacc "{BINDIR}"camllex "{BINDIR}"camlmktop ∂
  107.               "{BINDIR}:caml light"
  108.  
  109. # Remove all generated files (except the makefiles and the bootstrap compilers)
  110. clean ƒ
  111.     execute config
  112.     for d in {SUBDIRS}
  113.       directory {d}; {MAKE} clean; directory ::
  114.     end
  115.  
  116. # Rebuild the dependencies in all Makefiles
  117. depend ƒ
  118.     execute config
  119.     for d in {SUBDIRS}
  120.       directory {d}; {MAKE} depend; directory ::
  121.     end
  122.  
  123. # Rebuild all the generated source files.
  124. gensrc ƒ
  125.     execute config
  126.     for d in {SUBDIRS}
  127.       directory {d}; {MAKE} gensrc; directory ::
  128.     end
  129.